Задание 1. Загрузим данные и пакеты
ins_cost <- read.csv('insurance_cost.csv')
library(dplyr)
##
## Присоединяю пакет: 'dplyr'
## Следующие объекты скрыты от 'package:stats':
##
## filter, lag
## Следующие объекты скрыты от 'package:base':
##
## intersect, setdiff, setequal, union
library(ggplot2)
library(ggpubr)
library(plotly)
##
## Присоединяю пакет: 'plotly'
## Следующий объект скрыт от 'package:ggplot2':
##
## last_plot
## Следующий объект скрыт от 'package:stats':
##
## filter
## Следующий объект скрыт от 'package:graphics':
##
## layout
library(corrplot)
## corrplot 0.92 loaded
library(corrr)
library(factoextra)
## Welcome! Want to learn more? See two factoextra-related books at https://goo.gl/ve3WBa
library(dendextend)
##
## ---------------------
## Welcome to dendextend version 1.16.0
## Type citation('dendextend') for how to cite the package.
##
## Type browseVignettes(package = 'dendextend') for the package vignette.
## The github page is: https://github.com/talgalili/dendextend/
##
## Suggestions and bug-reports can be submitted at: https://github.com/talgalili/dendextend/issues
## You may ask questions at stackoverflow, use the r and dendextend tags:
## https://stackoverflow.com/questions/tagged/dendextend
##
## To suppress this message use: suppressPackageStartupMessages(library(dendextend))
## ---------------------
##
## Присоединяю пакет: 'dendextend'
## Следующий объект скрыт от 'package:ggpubr':
##
## rotate
## Следующий объект скрыт от 'package:stats':
##
## cutree
library(pheatmap)
library(ggbiplot)
## Загрузка требуемого пакета: plyr
## ------------------------------------------------------------------------------
## You have loaded plyr after dplyr - this is likely to cause problems.
## If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
## library(plyr); library(dplyr)
## ------------------------------------------------------------------------------
##
## Присоединяю пакет: 'plyr'
## Следующие объекты скрыты от 'package:plotly':
##
## arrange, mutate, rename, summarise
## Следующий объект скрыт от 'package:ggpubr':
##
## mutate
## Следующие объекты скрыты от 'package:dplyr':
##
## arrange, count, desc, failwith, id, mutate, rename, summarise,
## summarize
## Загрузка требуемого пакета: scales
## Загрузка требуемого пакета: grid
library(FactoMineR)
Задание 2
plot_ly(
data = ins_cost[(ins_cost$bmi != 0) & (ins_cost$charges != 0),],
x = ~ bmi,
y = ~ charges,
color = ~ smoker
)
## No trace type specified:
## Based on info supplied, a 'scatter' trace seems appropriate.
## Read more about this trace type -> https://plotly.com/r/reference/#scatter
## No scatter mode specifed:
## Setting the mode to markers
## Read more about this attribute -> https://plotly.com/r/reference/#scatter-mode